package com.atguigu.edu.pubshier.service.impl;

import com.atguigu.edu.pubshier.beans.TradeProvinceOrderAmount;
import com.atguigu.edu.pubshier.mapper.TradeStatsMapper;
import com.atguigu.edu.pubshier.service.TradeStatsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author: techyang
 * @since: 2023-10-22 19:01
 * @description:
 **/
@Service
public class TradeStatsServiceImpl implements TradeStatsService {

    @Autowired
    private TradeStatsMapper tradeStatsMapper;

    @Override
    public List<Map<String, Object>> getSubject(Integer date,String type) {
        switch (type) {
            case "amount":
                return tradeStatsMapper.selectSubjectAmount(date);
            case "orderCount":
                return tradeStatsMapper.selectSubjectOrderCount(date);
            case "orderUserCount":
                return tradeStatsMapper.selectSubjectOrderUserCount(date);
            default:
        }
        return null;
    }

    @Override
    public List<TradeProvinceOrderAmount> getProvinceAmount(Integer date) {
        return tradeStatsMapper.selectProvinceAmount(date);
    }

}
